//组合后端需要的QueryBody
export function transformPostBody(params) {
    let template = {
        "queryParam": {
        },
        //"order": "ascending",
        "sort": "updateTime"
    }
    for (const item in params) {
        if (params[item]) {
            template.queryParam[item] = params[item]
        }
    }
    return template;
}

//组合后端需要的QueryURL
export function transformRequestURL(params) {
    let template = {
    }
    for (const item in params) {
        if (params[item]) {
            template[item] = params[item]
        }
    }
    return template;
}

//组合后端需要的QueryURL和QueryBody
export function transformRequest(params) {
    // pageNum: 1,pageSize: 10组合到UrlParams
    //其余组合到body
    let template = {
        UrlParams: {},
        body: {
            "queryParam": {
            },
            //"order": "ascending",
            "sort": "updateTime"
        }
    }
    for (const item in params) {
        if (item == "pageNum" || item == "pageSize") {
            if (params[item]) {
                template.UrlParams[item] = params[item]
            }
            else if (item == "pageNum") {
                template.UrlParams[item] = 1
            }
            else if (item == "pageSize") {
                template.UrlParams[item] = 10
            }
        }
        else if (params[item]) {
            template.body.queryParam[item] = params[item]
        }
    }
    return template;
}